/************************************
 * Package: RGcpp					*
 * Authors: Rui Eduardo Gouveia Gil	*
 * Date: 2010						*
 ************************************/
#ifndef __RGCPP_DYNAMICSERVERSOCKET_H__
#define __RGCPP_DYNAMICSERVERSOCKET_H__

#ifdef _WIN32
#include <winsock2.h>
#endif
#include <openssl/ssl.h>
#include <openssl/err.h>

#include "rgcpp/net/ssl/SSLContext.h"
#include "rgcpp/net/ssl/DynamicSocket.h"
#include "rgcpp/exceptions/IOException.h"
#include "rgcpp/exceptions/RuntimeException.h"
#include "rgcpp/net/sockets/TCPServerSocket.h"

namespace rgcpp
{

class DynamicServerSocket : public TCPServerSocket
{
	private:
		bool sslMode;
		SSLContext* sslContext;
		static std::string password2check;

	public:
		DynamicServerSocket(SSLContext* sslContext);
		DynamicServerSocket(SSLContext* sslContext, const unsigned short port);
		DynamicServerSocket(SSLContext* sslContext, const IPAddress& ipAddress);
		~DynamicServerSocket();

		DynamicSocket* accept();

		void setStartSSLModel(bool sslMode);
};

}

#endif
